package net.frankish.moviebank.beans;

import java.util.HashMap;
import java.util.Vector;

import net.frankish.moviebank.back.PersistentBean;
import net.frankish.moviebank.back.Searchable;

public class Movie extends PersistentBean implements Searchable{
	private static final long serialVersionUID = 1L;

	private String title = null;
	private String producer = null;
	private String release = null;
	private String actors = null;
	private Vector<String> genre = null;
	private String coverPicture = null;
	private String description = null;
	private String identifier = null;
	private byte[] image = null;
	private int id = 0;

	/**
	 * Getters and Setters
	 */


	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	public String getTitle() {
		return title;
	}

	public void setTitle(String name) {
		this.title = name;
	}

	public String getActors() {
		return actors;
	}

	public void setActors(String actors) {
		this.actors = actors;
	}

	public String getCoverPicture() {
		return coverPicture;
	}

	public void setCoverPicture(String coverPicture) {
		this.coverPicture = coverPicture;
	}

	public Vector<String> getGenre() {
		return genre;
	}

	public void setGenre(Vector<String> genre) {
		this.genre = genre;
	}

	public String getProducer() {
		return producer;
	}

	public void setProducer(String producer) {
		this.producer = producer;
	}

	public String getRelease() {
		return release;
	}

	public void setRelease(String release) {
		this.release = release;
	}


	/**
	 * Special data manipulation methods
	 */


	@Override
	public void copyData(PersistentBean bean) {
		Movie m = (Movie)bean;
		this.actors = m.actors;
		this.coverPicture = m.coverPicture;
		this.genre = m.genre;
		this.producer = m.producer;
		this.title = m.title;
		this.release = m.release;
	}



	/**
	 * Searchable Interface
	 */
	public boolean matchesSearch(HashMap mapping) {
		return true;
	}

	public String[] getSearchHeaders() {
		return null;
	}

	public String[] getDisplayInfo() {
		return null;
	}

	public String getIdentifier() {
		return identifier;
	}

	public void setIdentifier(String identifier) {
		this.identifier = identifier;
	}

	public byte[] getImage() {
		return image;
	}

	public void setImage(byte[] image) {
		this.image = image;
	}

	@Override
	public String toString() {
		if(this.getRelease()!=null)
			return this.getTitle() + " ("+this.getRelease()+")";
		else
			return this.getTitle();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}



}
